package internal_test

import (
	"fmt"
	"testing"

	"gitcode.com/lin-xii/algorithm-and-structure/internal"
)

func TestBinarySearch(t *testing.T) {
	list := []int{1, 2, 3, 4, 5, 6, 7, 8}
	result := internal.BinarySearch(list, 1)
	if *result != 0 {
		t.Errorf("expect index 0, got %+v", *result)
	}

	result = internal.BinarySearch(list, 0)
	fmt.Printf("result %+v\n", result)
	if result != nil {
		t.Errorf("expect index nil, got %+v", result)
	}
}
